package faa;

import javax.swing.*;

import faa.objects.Action;
import faa.users.User;
import java.awt.*;
import java.awt.event.*;
import java.util.List;

public class GUI extends JFrame{
	/* Data */
	private SecurityManager sm;
	private User currentUser;
	
	public void msgWelcome(User user) {
		currentUser=user;
		currentUser.addDataListener(new newDataHandler());
	}
	
	public GUI(){
		setSize(840, 820);
		setVisible(true);
	}
	
	//Actions
	public void login(String username, String password){
		sm.msgLogin(username, password);
	}
	private class newDataHandler implements ActionListener {
		public void actionPerformed(ActionEvent e) {
			List<Action> actions = currentUser.getActions();
			for(Action name : actions) {
				System.out.println("GUI - Action Recieved: " + name);
			}
		}
	}
}
